#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "qpainter.h"

MainWindow::MainWindow(QWidget *parent) :  QMainWindow(parent),  ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->paint();

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::dessinerPlateau(QPainter  *paint) {
    paint->setBrush(Qt::lightGray);
    paint->drawRect(0, 0, 440, 440);
    for(int i=1; i < 8; i++) {
        paint->drawLine(0,i*440/8,500,i*440/8);
        paint->drawLine(i*440/8,0,i*440/8,500);
    }


}

void MainWindow::paint()
{
    QPixmap *img;
    QPainter  *paint;

    img = new QPixmap(440,440);
    paint = new QPainter(img);
    this->dessinerPlateau(paint);
    ui->plateau->setPixmap(*img);
    delete(paint);

}
